﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="TutorAdvanced.HubPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:TutorAdvanced"
    xmlns:common="using:TutorAdvanced.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>

        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">My Application</x:String>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Style="{StaticResource LayoutRootStyle}">
    	<Grid.Background>
    		<ImageBrush ImageSource="Assets/bg.png" Stretch="UniformToFill"/>
    	</Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid x:Name="Header">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" Grid.Column="1" Width="auto" HorizontalAlignment="Center"  Text="Your app slogan goes here" Style="{StaticResource PageHeaderTextStyle}" Foreground="Black"/>
            <Grid x:Name="TopLogo" HorizontalAlignment="Right" Height="100" VerticalAlignment="Center" Width="234" Grid.Column="1" Margin="0,0,60,0">
            	<Image Source="Assets/MainLogo.png"/>
            </Grid>
        </Grid>
        <ScrollViewer x:Name="scrollViewer" Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" FontWeight="Light">
        	<Grid x:Name="MainGrid" Margin="489,0,0,0">
        		<StackPanel Margin="0" Orientation="Horizontal" VerticalAlignment="Top">
        			<StackPanel x:Name="FirstGrid" Width="251" HorizontalAlignment="Left" Height="399">
        				<Grid x:Name="Inner" Height="399">
        					<Grid.RowDefinitions>
        						<RowDefinition Height="133"/>
        						<RowDefinition Height="166"/>
        						<RowDefinition Height="134*"/>
        					</Grid.RowDefinitions>
        					<Image Grid.RowSpan="3" Source="Assets/HubPage/HubPic1.png"/>
        					<Button Content="ALPHABETS" HorizontalAlignment="Center" VerticalAlignment="Bottom" Style="{StaticResource HubPageButton}" Padding="0" FontSize="26" Margin="-19,0,0,10" FontWeight="Normal" Tapped="Button_Tapped_1"/>
                            <Button Content="SOUNDS" HorizontalAlignment="Center" VerticalAlignment="Bottom" Grid.Row="1" Style="{StaticResource RedButtonStyle1}" Padding="0" FontSize="24" FontWeight="Normal" Margin="-19,0,0,10" Tapped="Button_Tapped_3"/>
        				</Grid>
        			</StackPanel>
        			<StackPanel x:Name="SecondGrid" Width="251" HorizontalAlignment="Left" Height="399">
        				<Grid x:Name="SecondInner" Height="399">
        					<Grid.RowDefinitions>
        						<RowDefinition Height="133"/>
        						<RowDefinition Height="166"/>
        						<RowDefinition Height="134*"/>
        					</Grid.RowDefinitions>
        					<Image Grid.RowSpan="3" Source="Assets/HubPage/HubPic1.png"/>
        					<Button Content="SHAPES" HorizontalAlignment="Center" VerticalAlignment="Bottom" Style="{StaticResource HubPageButton}" Padding="0" FontSize="26" Margin="-19,0,0,10" FontWeight="Normal" Tapped="Button_Tapped_2"/>
        					<Button Content="CURRENCY" HorizontalAlignment="Center" VerticalAlignment="Bottom" Grid.Row="1" Style="{StaticResource RedButtonStyle1}" Padding="0" FontSize="24" FontWeight="Normal" Margin="-19,0,0,10" Tapped="Button_Tapped_4"/>
        				</Grid>
        			</StackPanel>
        			<StackPanel x:Name="ThirdGrid" Width="251" HorizontalAlignment="Left" Height="399">
        				<Grid x:Name="ThirdInner" Height="399">
        					<Grid.RowDefinitions>
        						<RowDefinition Height="133"/>
        						<RowDefinition Height="166"/>
        						<RowDefinition Height="134*"/>
        					</Grid.RowDefinitions>
        					<Image Grid.RowSpan="3" Source="Assets/HubPage/HubPic1.png"/>
        					<Button Content="COLORS" HorizontalAlignment="Center" VerticalAlignment="Bottom" Style="{StaticResource HubPageButton}" Padding="0" FontSize="26" Margin="-19,0,0,10" FontWeight="Normal" Tapped="Button_Tapped_5"/>
        					<Button Content="NUMBERS" HorizontalAlignment="Center" VerticalAlignment="Bottom" Grid.Row="1" Style="{StaticResource RedButtonStyle1}" Padding="0" FontSize="24" FontWeight="Normal" Margin="-19,0,0,10" Tapped="Button_Tapped_6"/>
        				</Grid>
        			</StackPanel>
        		</StackPanel>
        	</Grid>
        </ScrollViewer>
        <Grid x:Name="grid" Grid.RowSpan="2" Visibility="Collapsed">
        	<TextBlock HorizontalAlignment="Center" TextWrapping="Wrap" Text="Please switch to full screen to view the details." VerticalAlignment="Center" Margin="10,0" FontFamily="Segoe UI" FontSize="26" Foreground="#FF272727"/>
        </Grid>

        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopLogo" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="grid">
                        	<DiscreteObjectKeyFrame KeyTime="0">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Visibility>Collapsed</Visibility>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="MainGrid">
                        	<DiscreteObjectKeyFrame KeyTime="0">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Thickness>120,0,0,0</Thickness>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TopLogo" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>

                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="scrollViewer" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="grid" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>

                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="TopLogo">
                        	<DiscreteObjectKeyFrame KeyTime="0">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Thickness>2,0,0,0</Thickness>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="pageTitle">
                        	<DiscreteObjectKeyFrame KeyTime="0">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Thickness>0,0,0,40</Thickness>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
